package cn.iocoder.yudao.module.erp.controller.admin.dp.dpalmt.vo;

import lombok.*;

import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;


@Schema(description = "管理后台 - ERP阿拉木图仓库分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DpAlmtPageReqVO extends PageParam {

    @Schema(description = "运单号")
    private String id;

    @Schema(description = "运单号列表")
    private List<String> ids;

    @Schema(description = "货号")
    private String no;

    @Schema(description = "仓库类型 阿拉木图仓8", example = "1")
    private Integer storeType;

    @Schema(description = "入库品名", example = "王五")
    private String inName;

    @Schema(description = "出库后展示")
    private String dispatchNumber;

    @Schema(description = "总件数", example = "23069")
    private Integer inCount;

    @Schema(description = "总体积")
    private Double inVolume;

    @Schema(description = "总重量")
    private Double weight;

    @Schema(description = "剩余总件数", example = "32158")
    private Integer remCount;

    @Schema(description = "剩余总体积")
    private Double remVolume;

    @Schema(description = "剩余总重量")
    private Double remWeight;

    @Schema(description = "到货件数")
    private Integer arrCount;

    @Schema(description = "到货体积")
    private Double arrVolume;

    @Schema(description = "到货重量")
    private Double arrWeight;

    @Schema(description = "到货时间")
    private LocalDateTime arrivedTime;

    @Schema(description = "配车出库时单据的备注说明")
    private String totalNote;

    @Schema(description = "密度")
    private Double density;

    @Schema(description = "送货人联系方式")
    private String deliveryPhone;

    @Schema(description = "送货人名称", example = "张三")
    private String deliveryName;

    @Schema(description = "垫付金额")
    private Double earpayAmount;

    @Schema(description = "入库照片")
    private String inPic;

    @Schema(description = "线路选择 东线1 西线2")
    private Integer line;

    @Schema(description = "用户输入的具体路线")
    private String way;

    @Schema(description = "货值")
    private Double goodsValue;

    @Schema(description = "保费")
    private Double premium;

    @Schema(description = "保率")
    private Integer guaranteedRate;

    @Schema(description = "是否核销 0否1是")
    private Integer writeOff;

    @Schema(description = "核销费用")
    private Double writeExpenses;

    @Schema(description = "优惠金额")
    private Double discountAmount;

    @Schema(description = "附件")
    private String file;

    @Schema(description = "备注")
    private String note;

    @Schema(description = "发货人")
    private String shipper;

    @Schema(description = "目的地")
    private String destination;

    @Schema(description = "收货人")
    private String consignee;

    @Schema(description = "垫付打包费")
    private Double advancePayPack;

    @Schema(description = "垫付提货费")
    private Double advancePayPackUp;

    @Schema(description = "垫付国内运费")
    private Double advancePayChinaFreight;

    @Schema(description = "垫付货款")
    private Double advancePayForGoods;

    @Schema(description = "代收")
    private Double collecting;

    @Schema(description = "客户返点")
    private Double customerRebate;

    @Schema(description = "业务返点")
    private Double businessRebate;

    @Schema(description = "审核状态 未审核0 审核1", example = "1")
    private Integer status;

    @Schema(description = "支付类型(1国内支付 2国外支付)", example = "2")
    private Integer payType;

    @Schema(description = "业务员")
    private String salesman;

    @Schema(description = "单价", example = "29556")
    private Double unitPrice;

    @Schema(description = "立方单价", example = "10")
    private Double cubeUnitPrice;

    @Schema(description = "总金额计算方式 1按重量 2按立方 3按整车 4按重量和立方")
    private Integer calmethod;

    @Schema(description = "总金额")
    private Double totalAmount;

    @Schema(description = "是否拆票 0否 1是")
    private Integer isSplit;

    @Schema(description = "出入库状态 0未出库 1已出库 2已入库", example = "1")
    private Integer inventoryStatus;

    @Schema(description = "提货状态", example = "0未提货 1已提货 2配送完成")
    private Integer pickStatus;

    @Schema(description = "到货签收")
    private Integer arrStatus;

    @Schema(description = "已签收数量")
    private Integer signNum;

    @Schema(description = "签收类型")
    private Integer signStatus;

    @Schema(description = "创建人")
    private String creator;

    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime[] createTime;

    @Schema(description = "制单时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime[] chooseDate;

    public String[] getChooseDateStr() {
        if (chooseDate == null || chooseDate.length != 2) {
            return null;
        }
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return new String[]{
                chooseDate[0].toLocalDate().format(formatter),
                chooseDate[1].toLocalDate().format(formatter)
        };
    }

}